package com.zsy.dao.commonmaper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zsy.dao.model.TbPermission;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zhaoshouyun
 * @since 2020-04-15
 */
public interface CommonUserMapper extends BaseMapper<Object> {

    @Select("select p.*from tb_user u \n" +
            "left join tb_user_role ur on u.id = ur.user_id\n" +
            "LEFT JOIN tb_role r on ur.role_id = r.id\n" +
            "LEFT JOIN tb_role_permission rp on r.id = rp.role_id\n" +
            "LEFT JOIN tb_permission p on p.id = rp.permission_id\n" +
            "where u.id = #{id}")
    public List<TbPermission> listTbPermission(@Param("id") BigDecimal id);

}
